<template>
	<view>
		<button @click="onSetTimecall()">单次定时器setTimeout</button>
		<button @click="onSetTimecallxy(username,password)">带参数setTimeout</button>
		<button @click="onTimeoutClear" type="warn">取消定时器</button>
		<button @click="onInteral()" type="">周期打印</button>
		<button @click="onClearInter()" type="warn">取消周期打印</button>
	</view>
</template>

<script>
import LogPageVue from '../LogPage/LogPage.vue';

	export default {
		data() {
			return {
				username:'qkh',
				password:'123',
				timeoutID:null,
				count:0,
			}
		},
		methods: {
			onSettimeCall(){
				console.log("onSeTimeCall-->");
				//setimeout(callback,ms,any[]) X
				// 箭头函数（匿名函数）
				setTimeout(()=>{
					console.log("yshi");
				},3000)
			},
			onSettimeCallxy(name,pwd){
				console,log("onSetTimecallxy--> name:"+name+",pwd"+pwd);
				// console,log("onSetTimecallxy--> name:"+this.username+",pwd"+password);
				setTimeout((x,y)=>{
					console.log("chuangcan> x:"+x+",y"+y);
				},2000,name.pwd);
			},
			onTimeoutClear(){
				console.log("onTimeouutClear--->定时器取消："+this.timeoutID);
				clearTimeout(this.tineoutID)
			},
			onInteral(){
				setInteral(()=>{
					this.count++;
				console.log("周期打印：",this.count);	
				},1000)
				
			},
			onClearInter(){
				console.log();
			}
		}
	}
</script>

<style>

</style>
